<html>
<head>
    <title>微信支付</title>
    <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
    <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" id="viewport" name="viewport">
    <script language="javascript" src="${base}/js/weixin/jquery.js"></script>
    <script language="javascript" src="${base}/js/weixin/lazyloadv3.js"></script>
    <script language="javascript">
        function onBridgeReady(){
            WeixinJSBridge.invoke(
                    'getBrandWCPayRequest', {
                        "appId" : "wx191fc28ce039710b",     //公众号名称，由商户传入
                        "timeStamp":"${timestamp}",         //时间戳，自1970年以来的秒数
                        "nonceStr" : "${nonceStr}", //随机串
                        "package" : "${p}",
                        "signType" : "MD5",         //微信签名方式:
                        "paySign" : "${sign}" //微信签名
                    },
                    function(res){
                        if(res.err_msg == "get_brand_wcpay_request:ok" ) {
                            alert("支付成功！");
                        } else if (res.err_msg == "get_brand_wcpay_request:cancel" ) {
                            alert("支付取消！");
                        } else if (res.err_msg == "get_brand_wcpay_request:fail" ) {
                            alert("支付失败！");
                            alert(res.err_code+res.err_desc+res.err_msg);
                            WeixinJSBridge.log(res.err_msg);

                        }
                    }
            );
        }
        if (typeof WeixinJSBridge == "undefined"){
            if( document.addEventListener ){
                document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
            }else if (document.attachEvent){
                document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
                document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
            }
        }else{
            onBridgeReady();
        }
</script>
</head>
<body>
</body>
</html>
